
package com.probiz.estore.core.security;

import java.util.HashSet;
import java.util.Set;

import org.acegisecurity.GrantedAuthority;

public class ResourceMapping {
	// roles
	private Set<GrantedAuthority> recipients	= new HashSet<GrantedAuthority>();
	// url path
	private String		resourcePath;
	private String    permission;
	/**
	 * 权限类型，参看Constants.SECURITY_TYPE_MENU 和 Constants.SECURITY_TYPE_RESOURCE
	 */
	private Short type;
	public Set<GrantedAuthority> getRecipients() {
		return recipients;
	}
	public void setRecipients(Set<GrantedAuthority> recipients) {
		this.recipients = recipients;
	}
	public void addRecipient(GrantedAuthority recipient){
		this.recipients.add(recipient);
	}
	public void addRecipients(Set<GrantedAuthority> recipients){
		this.recipients.addAll(recipients);
	}
	public void addRecipients(GrantedAuthority[] recipients){
		if(recipients != null){
			for(int i=0; i<recipients.length; i++){
				this.recipients.add(recipients[i]);
			}
		}
	}
	public String getResourcePath() {
		return resourcePath;
	}
	public void setResourcePath(String resourcePath) {
		this.resourcePath = resourcePath;
	}
	public String getPermission() {
		return permission;
	}
	public void setPermission(String permission) {
		this.permission = permission;
	}
	public Short getType() {
		return type;
	}
	public void setType(Short type) {
		this.type = type;
	}
	
	
    
}